<%-- 
    Document   : admin_home
    Created on : 16 Jan, 2013, 7:27:53 PM
    Author     : s
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="connection.jsp" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="css/theme.css" />
        <link rel="stylesheet" type="text/css" href="css/style.css" />
        <script>
             var StyleFile = "theme" + document.cookie.charAt(6) + ".css";
             document.writeln('<link rel="stylesheet" type="text/css" href="css/' + StyleFile + '">');
        </script>
        <link rel="stylesheet" href="js/jquery-ui-1.8.23.custom/development-bundle/themes/base/jquery.ui.all.css">
        <script src="js/jquery-ui-1.8.23.custom/js/jquery-1.7.2.min.js" type="text/javascript"></script> 
        <script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.core.js"></script>
	<script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.widget.js"></script>
	<script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.accordion.js"></script>
        
         
        <script>
    $(function() {
		$( "#sidebar" ).accordion({
			autoHeight:false,
                        event: "mouseover"
		});
	});
    
</script>
    </head>
    <body>
                          
        <div id="container">
                <div id="header">
                    <h2>Stock Market Website</h2>
                    <div id="topmenu">
                      <ul>
                	<li><a href="admin_page.jsp">Dashboard</a></li>
                        <li class="current"><a href="admin_users.jsp">Users</a></li>
                        <li><a href="companies.jsp">Companies</a></li>
                        
                        <!--<li><a href="chatgroup_admin.jsp">Chat Group</a></li>-->
                        <li><a href="experts_admin.jsp">Experts</a></li>
                        
                      </ul>
                    </div>
                </div>
<div id="top-panel">
          <div id="panel">
          <form action="" name="quoteform" >
              	<input type="text" placeholder="Enter company symbol" name="sym_nm" id="sym_id" />
                <input type="submit" value="Get Stock Value" />
            </form>
          </div>
      </div>        
        <div id="wrapper">
            <div id="content">
                <div id="box">
                    <h3>Find Users</h3>
                <p>
                

                <form method="POST" action="">
                <table>
                        <tr>
                            <td><b>Search By:</b></td>
                            <td><select name="search">
                                    <option value="1">User Name</option>
                                    <option value="2">E-mail</option>
                                    <option value="3">Package</option>
                                                                        
                                </select></td>
                                <td> <input type="text" name="val" value="" /></td>
                                <td> <input type="submit" value="SEARCH" />
                        </tr>
                    
                   
                </table>    
                </form>
                <%
                try{
                    
                    String text,a;
                    int opt;
                   
                    a=request.getParameter("search").toString();
                    opt= Integer.parseInt(a);
                    text = request.getParameter("val").toString();
                     st = con.createStatement();
                   
                    switch(opt)
                    {
                        case 1:
                             
                             rs = st.executeQuery("select * from user where f_name like '%"+text+"%' or l_name like '%"+text+"%'");
                             break;
                            
                        case 2:
                             
                             rs = st.executeQuery("select * from user where e_mail like '%" + text + "%' ");
                            break;
                        
                        case 3:
                             
                             rs = st.executeQuery("select sr_no,e_mail,f_name,l_name,password,mo_no,package.pac_name,sub_dt from user,package where user.pac_id like '%" + text + "%' and user.pac_id=package.pac_id");
                             break;
                        
                        default:
                            out.println("Please select valid option");
                            break;
                            
                        
                    }
                    text = null;
                    
                   %>
                     <table border='1'>
                         <thead>
                             <tr>
                            <th><center><b>Sr No</b></center></th>
                            <th><center><b>Name</b></center></th>
                            <th><center><b>ID</b></center></th>
                            <th><center><b>Mobile NO</b></center></th>
                            <th><center><b>Package</b></center></th>
                            <th><center><b>Sub_St_Date</b></center></th>
                            <th><center><b>Operations</b></center></th>
                            </tr>
                    </thead>
                        <%   

                        while(rs.next())
                        {
                            out.print("<tr>");
                                                                           
                            out.print("<td>");
                            out.print(rs.getString(1));
                            out.print("</td>");
                            
                            out.print("<td>");
                            out.print(rs.getString(3)+" "+rs.getString(4));
                            out.print("</td>");

                            out.print("<td>");
                            out.print(rs.getString(2));
                            out.print("</td>");
    
                            out.print("<td>");
                            out.print(rs.getString(6));
                            out.print("</td>");

                            out.print("<td>");
                            out.print(rs.getString(7));
                            out.print("</td>");

                            out.print("<td>");
                            out.print(rs.getString(8));
                            out.print("</td>");
                            
                            out.print("<td>");
                            out.print("<a href='user_update.jsp?id="+rs.getString(1)+"'><img src='img/icons/user_edit.png'></a>");
                            out.print("<a href='user_delete.jsp?id="+rs.getString(1)+"'><img src='img/icons/user_delete.png'></a>");
                            out.print("</td>");
                            

                        }
                                          }
                                            catch(Exception e){}
                        
                                            
                                            
                                            
                                            
                        %>
                        
                        
                        
                     </table>
                
                
                </p>
                </div> 
                <p>&nbsp;</p>
            </div>
                     
            

        <div id="sidebar">
  	
                	<li><h3><a href="#" class="house">Dashboard</a></h3>
                        <ul>
                        	<li><a href="logout.jsp" class="report">Logout</a></li>
                        </ul>
                    </li>
                    
                  <li><h3><a href="#" class="user">Users</a></h3>
          				<ul>
                         
                          	<li><a href="find_user.jsp" class="search">Find user</a></li>
                            <li><a href="#" class="online">Users online</a></li>
                        </ul>
                    </li>
				       
          </div>
      </div>
        <div id="footer">
        <div id="styleswitcher">
            <ul>
                <li><a href="javascript: document.cookie='theme='; window.location.reload();" title="Default" id="defswitch">d</a></li>
                <li><a href="javascript: document.cookie='theme=1'; window.location.reload();" title="Blue" id="blueswitch">b</a></li>
                <li><a href="javascript: document.cookie='theme=2'; window.location.reload();" title="Green" id="greenswitch">g</a></li>
                <li><a href="javascript: document.cookie='theme=3'; window.location.reload();" title="Brown" id="brownswitch">b</a></li>
                <li><a href="javascript: document.cookie='theme=4'; window.location.reload();" title="Mix" id="mixswitch">m</a></li>
                <li><a href="javascript: document.cookie='theme=5'; window.location.reload();" title="Mix" id="defswitch">m</a></li>
            </ul>
        </div><br />

        </div>
</div>
</body>
</html>
